package com.elephant.core.utils.excel;

import com.elephant.core.utils.EncryptUtile;
import com.elephant.core.utils.sqlit.SqlitUtil;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @author hai
 * @description
 * @date 13:40 2018/9/30
 */
public class Sentence {

    public static void main(String[] args) {

        try {
            Connection connection = SqlitUtil.createConnection();


            String sql = "SELECT id,sentence_content_cn FROM t_sentence;";
            ResultSet rs = SqlitUtil.func1(sql, connection);
            while (rs.next()){
                String id = rs.getString("id");
                String content = rs.getString("sentence_content_cn");
                String content_new = EncryptUtile.decrypt(content);
                System.out.println(id + "----" + content_new);
                String sqlNew = "insert into t_sentence_temp_1 (`sen_id`,`content`) values('" + id + "','" + content_new + "');";
                SqlitUtil.execute(sqlNew,connection);
            }

        } catch (SQLException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
